/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package towerdefense.data;

/**
 *
 * @author stefan
 */
public class Creep {

    private CreatureType type;
    private int hitpoints;
    private int speed;
    private boolean alive;
    private WayTile position;

    public Creep(CreatureType type, int hitpoints, int speed, WayTile start) {
        alive = true;
        this.type = type;
        this.hitpoints = hitpoints;
        this.speed = speed;
        this.position = position;
    }

    public void move() {
        position = position.getNextTile();
    }

    public CreatureType getType() {
        return type;
    }

    public int getHitpoints() {
        return hitpoints;
    }

    public boolean hit(int damage) {
        hitpoints -= damage;
        if (hitpoints <= 0) {
            die();
            return true;
        }
        return false;
    }

    public int getSpeed() {
        return speed;
    }

    private void die() {
        alive = false;
    }
}